<?php

use Illuminate\Database\Seeder;
use App\Models\Users\Permission;
use App\Models\Users\Role;

class PermissionSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $role = Role::whereName('Founder')->first();
        if (!empty($role)) {
            $role->attachPermissions([
                Permission::create(['name' => 'administrator', 'description' => '超级管理员', 'display_name' => '拥有超级管理权限']),
                Permission::create(['name' => 'admin-web', 'description' => '管理面板', 'display_name' => 'web 管理面板']),
                Permission::create(['name' => 'admin-user', 'description' => '管理用户', 'display_name' => '管理用户']),
                Permission::create(['name' => 'admin-role', 'description' => '管理角色', 'display_name' => '管理角色']),
                Permission::create(['name' => 'admin-store', 'description' => '管理店铺', 'display_name' => '管理店铺']),
                Permission::create(['name' => 'admin-ticket', 'description' => '管理优惠券', 'display_name' => '管理优惠券']),
                Permission::create(['name' => 'admin-setting', 'description' => '网站设置', 'display_name' => '网站设置']),
                Permission::create(['name' => 'can-login', 'description' => '可以登录', 'display_name' => '可以登录'])
            ]);
        }
    }
}
